package zb.blog.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import zb.blog.base.bean.Result;
import zb.blog.bean.FriendLinkBean;
import zb.blog.service.IFriendLinkService;

import java.util.Map;

@Controller
@RequestMapping("/friendLink")
public class FriendLinkController {
    @Autowired
    private IFriendLinkService iFriendLinkService;

    @RequestMapping(value = "/getFriendLink", method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<FriendLinkBean> getFriendLink() {
        return iFriendLinkService.getFriendLink();
    }

    @RequestMapping(value = "/back/getFriendLinkAll", method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<FriendLinkBean> getFriendLinkAll(@RequestBody Map<String, String> param) {
        return iFriendLinkService.getFriendLinkAll(param);
    }

    @RequestMapping(value = "/back/updateStatusById", method = RequestMethod.POST)
    @ResponseBody
    public Result updateStatusById(Integer id, Integer status) {
        return iFriendLinkService.updateStatusById(id, status);
    }

    @RequestMapping(value = "/back/getFriendLinkbyId", method = RequestMethod.POST)
    @ResponseBody
    public FriendLinkBean getFriendLinkbyId(Integer id) {
        return iFriendLinkService.getFriendLinkbyId(id);
    }

    @RequestMapping(value = "/back/editFriendLink", method = RequestMethod.POST)
    @ResponseBody
    public Result editFriendLink(FriendLinkBean friendLinkBean, String type) {
        return iFriendLinkService.editFriendLink(friendLinkBean, type);
    }
}
